<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * 项目用人需求模型
 *
 * Date: 25/04/2018
 * @author George
 * @package App\Models
 */
class Demand extends Model
{
	/**
	 * 定义不可填充字段
	 *
	 * @var array
	 * Date: 25/04/2018
	 * @author George
	 */
	protected $guarded = ['id'];

	/**
	 * 获取班次详情
	 *
	 * Date: 25/04/2018
	 * @author George
	 * @return \Illuminate\Database\Eloquent\Relations\HasOne
	 */
	public function genre()
	{
		return $this->hasOne(Genre::class, 'id', 'genre_id');
	}

	/**
	 * 获取排班信息
	 *
	 * Date: 04/05/2018
	 * @author George
	 * @return \Illuminate\Database\Eloquent\Relations\HasMany
	 */
	public function schedules()
	{
		return $this->hasMany(Schedule::class, 'demand_id', 'id');
	}
}
